<?php
$name = trim($_POST['eventname']);
$icon = $_POST['icon'];
$id = $_POST['id'];
$img = $_POST['imgurl'];
include_once 'connect.php';
if (!empty($img)){
    $img = $_POST['imgurl'];
}else{
    $img = 0;
}
if (!$icon){
    $icon = 0;
}else{
    $icon = $_POST['icon'];
}

$sql = "update lovelist set eventname = '$name',icon ='$icon',imgurl ='$img' where id ='$id' ";
$reslove = mysqli_query($connect,$sql);
if ($reslove){
    echo "<script>alert('修改成功--$id');location.href = '/admin/lovelist.php';</script>";
}else{
    echo "<script>alert('修改失败');history.back();</script>";
}